package com.enjoy.stream;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static java.util.stream.Collectors.groupingBy;

public class Test {

    static class Book {

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getAuthor() {
            return author;
        }

        public void setAuthor(String author) {
            this.author = author;
        }

        public int getMoney() {
            return money;
        }

        public void setMoney(int money) {
            this.money = money;
        }

        public Book(String name, String author, int money) {
            this.name = name;
            this.author = author;
            this.money = money;
        }

        private String name;

        private String author;

        private int money;
    }

    public static void main(String[] args) {
        Book book1 = new Book("java", "james", 11);
        Book book2 = new Book("c", "james", 11);
        Book book3 = new Book("py", "kobe", 11);
        List<Book> list = new ArrayList<>();
        list.add(book1);
        list.add(book2);
        list.add(book3);
        Map<String, List<Book>> map = list.stream().collect(groupingBy(Book::getAuthor));
        System.out.println(map.keySet().size());


        BigDecimal bigDecimal = new BigDecimal("0.01");

        BigDecimal decimal = new BigDecimal(1);

        BigDecimal sum = decimal.add(bigDecimal);

        System.out.println(sum);

        for (int i = 0; ; i++) {
            System.out.println(i);
            if (i >= 7) {
                break;
            }
        }

    }
}
